package com.hwadee.ems.controller;

import java.util.List;
import java.util.stream.Collectors;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hwadee.ems.domain.dto.Result;
import com.hwadee.ems.domain.vo.MajorVO;
import com.hwadee.ems.service.IMajorService;

import jakarta.annotation.Resource;

/**
 * <p>
 * 专业 前端控制器
 * </p>
 *
 * @author EnosElinsa
 * @since 2024/06/21
 */
@RestController
@RequestMapping("/major")
public class MajorController {

    @Resource
    private IMajorService majorService;

    @GetMapping("/list")
    public Result<List<MajorVO>> list() {
        return Result.ok(
            majorService.list()
                .stream()
                .map(MajorVO::new)
                .collect(Collectors.toList())
        );
    }

}
